<!-- Imports -->
<%@page import="java.util.LinkedList"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Hashtable"%>
<%@page import="canss.supports.basic"%>
<%@page import="canss.supports.Makequery_select"%>
<!-- Component start -->
<%{ %>
<!-- Initiation -->
<%
	response.setContentType("text/html; charset=UTF-8");
%>
<!-- Load Variables -->
<%
	// because of cross-domaining, client-side scripting (ajax) doesn't work.
	// so, server gives the result. 
	java.net.URL u = new java.net.URL("http://mediator.canss.net/ServiceManager/reportStorageStatus.php");
	java.net.URLConnection uc = (java.net.URLConnection)u.openConnection();
	uc.setDoInput(true);
	java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(uc.getInputStream()));
	String msg = "";
	String inputLine;
	while((inputLine = in.readLine())!=null)
		msg += inputLine;
	in.close();
	
	String[] m = msg.split("<br/>");
	String[] mediastoragedata_mm = m[0].split(",");
	String[] mediastoragedata_mf = m[1].split(",");
%>
	
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
		var mediastoragedata_mf;
		var mediastoragedata_mm;
		
		// Load the Visualization API and the piechart package.
		google.load('visualization', '1', {'packages':['piechart']});
		// Set a callback to run when the Google Visualization API is loaded.
    google.setOnLoadCallback(drawChartStorageStatus_div);
    
    function drawChartStorageStatus_div()
    {
	    ////////chart
			var mediastoragedata = new google.visualization.DataTable();
			mediastoragedata.addColumn('string', 'Status');
			mediastoragedata.addColumn('number', 'Counts');
			mediastoragedata.addRows([
				 ['Farm Used (KB)', <%=mediastoragedata_mf[2]%> ],
				 ['Farm Available (KB)', <%=mediastoragedata_mf[3]%> ],
				 ['Encoder Used (KB)', <%=mediastoragedata_mm[2]%> ],
				 ['Encoder Available (KB)', <%=mediastoragedata_mm[3]%> ]
				]);		
			var storagedivchart = new google.visualization.PieChart(document.getElementById('StorageStatus_div'));
			storagedivchart.draw(mediastoragedata, {width: 480, height: 300, is3D: true, title: 'Storage Status'});
		}
		
	</script>

<div id="StorageStatus_div"></div>
<%} %>
<!-- Component end -->